<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">

<h:head></h:head>


<body>

	<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
		template="./../WEB-INF/Facelets/mainTemplate.xhtml">

<ui:define name="content">

	<div id="content">
			<h:form id="form">
			
    <script>  
    
                function mascara(o, f) {  
                  v_obj = o;  
                  v_fun = f;  
                  setTimeout("execmascara()", 1);  
                }  
      
                function execmascara() {  
                  v_obj.value = v_fun(v_obj.value);  
                }  
      
             	function valor(v) {  
	            v = v.replace(/\D/g, "");  
	            v = v.replace(/[0-9]{15}/, "invÃ¡lido");  
	            v = v.replace(/(\d{1})(\d{11})$/, "$1.$2"); // coloca ponto antes dos  
	            // Ãºltimos 11 digitos  
	            v = v.replace(/(\d{1})(\d{8})$/, "$1.$2"); // coloca ponto antes dos  
	            // Ãºltimos 8 digitos  
	            v = v.replace(/(\d{1})(\d{5})$/, "$1.$2"); // coloca ponto antes dos  
	            // Ãºltimos 5 digitos  
	            v = v.replace(/(\d{1})(\d{1,2})$/, "$1,$2"); // coloca virgula antes dos  
	            // Ãºltimos 2 digitos  
	            return v;  
    			}  
      
   </script> 
   
				<p:panel header="Abastecimentos" style="font-size:25px;">


					<h:panelGrid id="gridFormAba" columns="4" cellpadding="5"
						style="margin-bottom:5px; font-size:12px; font-weight:bold;">
						
									    
						<h:outputText value="Data de Abastecimento* " />
							<h:panelGrid>
								<p:calendar size="6" value="#{calendarBean.date2}" id="popupCal" /> 
								<h:outputText value="#{calendarBean.date2}" id="popupDate">  
                					<f:convertDateTime pattern="d/M/yyyy"/>  
            					</h:outputText> 
            				</h:panelGrid>

						<h:outputLabel value="Combustível* " />
							<p:selectOneMenu value="#{buttonBean.number}"> 
        					  <f:selectItem size= "6" itemLabel="" itemValue="1" />				           			            
        					</p:selectOneMenu> 

						<h:outputLabel value="Valor* "/>
						<p:inputText value="#{ProdutoBean.valor}" maxlength="12" size="9" onkeypress="mascara(this, valor);" />  

						<h:outputLabel value="Quantidade/Litros* " />
						<p:inputText size="10" maxlength="11" value="#{personBean.firstname}" />

						<h:outputLabel value="Frota* " />
							<p:selectOneMenu value="#{buttonBean.number}"> 
        					  <f:selectItem size= "6" itemLabel="" itemValue="1" />				           			            
        					</p:selectOneMenu>

						<h:outputLabel value="KM do Último Abastecimento* " />
						<p:inputText size="10" maxlength="11" value="#{personBean.firstname}" />

						<h:outputLabel value="KM/Atual* " />
						<p:inputText size="10" maxlength="11" value="#{personBean.firstname}" />

						<h:outputLabel value="KM/Litro " />
						<p:inputText value="#{ProdutoBean.valor}" maxlength="12" size="9" onkeypress="mascara(this, valor);" />

						<h:outputLabel value="Motorista* " />
							<p:selectOneMenu value="#{buttonBean.number}"> 
        					  <f:selectItem size= "6" itemLabel="" itemValue="1" />				           			            
        					</p:selectOneMenu>

						<h:outputLabel value="Observações " />
						<p:inputTextarea maxlength="500"	value="#{personBean.firstname}" />

					</h:panelGrid>
					<!-- fim da grid griFormAba -->

					<h:panelGrid id="gridBotoesAba" columns="2" cellpadding="3"
						style="margin-bottom:5px; font-size:12px; font-weight:bold;">
						<p:commandButton value="Limpar" type="reset" />
						<p:commandButton value="Cadastrar" type="submit" />
					</h:panelGrid>
					<!-- fim da grid gridBotoesAba -->

				</p:panel>
				<!-- fim do panel Abastecimentos -->

			</h:form>
			<!-- fim do formulario -->

		</div>
		<!-- fim da div content -->


		</ui:define>

	</ui:composition>

</body>
</html>
